package com.ddw.wotcg.client.threejs.core;

import com.ddw.wotcg.client.threejs.materials.Material;
import com.ddw.wotcg.client.threejs.math.Color;
import com.ddw.wotcg.client.threejs.math.Matrix4;
import com.ddw.wotcg.client.threejs.math.Vector2;
import com.ddw.wotcg.client.threejs.math.Vector3;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayInteger;
import com.google.gwt.core.client.JsArrayNumber;

/**
 * http://mrdoob.github.com/three.js/docs/54/#Reference/Core/Geometry
 * 
 * @author fungus1487
 * 
 */
public class Geometry extends JavaScriptObject {
	
	/**
	 * http://mrdoob.github.com/three.js/docs/54/#Reference/Core/Geometry
	 * 
	 * @author fungus1487
	 * 
	 */
	public static final class BoundingBox extends JavaScriptObject {
		
		protected BoundingBox() {
		}
		
		public native Vector3 getMax() /*-{
			return this.max;
		}-*/;
		
		public native Vector3 getMin() /*-{
			return this.min;
		}-*/;
		
	}
	
	/**
	 * http://mrdoob.github.com/three.js/docs/54/#Reference/Core/Geometry
	 * 
	 * @author fungus1487
	 * 
	 */
	public static final class BoundingSphere extends JavaScriptObject {
		
		protected BoundingSphere() {
		}
		
		public native double getRadius() /*-{
			return this.radius;
		}-*/;
		
	}
	
	/**
	 * http://mrdoob.github.com/three.js/docs/54/#Reference/Core/Geometry
	 * 
	 * @author fungus1487
	 * 
	 */
	public static final class MorphColor extends JavaScriptObject {
		
		protected MorphColor() {
		}
		
		public native JsArray<Color> getColors() /*-{
			return this.vertices;
		}-*/;
		
		public native String getName() /*-{
			return this.name;
		}-*/;
		
	}
	
	/**
	 * http://mrdoob.github.com/three.js/docs/54/#Reference/Core/Geometry
	 * 
	 * @author fungus1487
	 * 
	 */
	public static final class MorphTarget extends JavaScriptObject {
		
		protected MorphTarget() {
		}
		
		public native String getName() /*-{
			return this.name;
		}-*/;
		
		public native JsArray<Vector3> getVertices() /*-{
			return this.vertices;
		}-*/;
		
	}
	
	public static native Geometry create() /*-{
		return new $wnd.THREE.Geometry()
	}-*/;
	
	protected Geometry() {
	}
	
	public native final void applyMatrix(Matrix4 matrix) /*-{
		this.applyMatrix(matrix);
	}-*/;
	
	public native final void computeBoundingBox() /*-{
		this.computeBoundingBox();
	}-*/;
	
	public native final void computeBoundingSphere() /*-{
		this.computeBoundingSphere();
	}-*/;
	
	public native final void computeCentroids() /*-{
		this.computeCentroids();
	}-*/;
	
	public native final void computeFaceNormals() /*-{
		this.computeFaceNormals();
	}-*/;
	
	public native final void computeTangents() /*-{
		this.computeTangents();
	}-*/;
	
	public native final void computeVertexNormals() /*-{
		this.computeVertexNormals();
	}-*/;
	
	public native final BoundingBox getBoundingBox() /*-{
		return this.boundingBox;
	}-*/;
	
	public native final BoundingSphere getBoundingSphere() /*-{
		return this.boundingSphere;
	}-*/;
	
	public native final JsArray<Color> getColors() /*-{
		return this.colors;
	}-*/;
	
	public native final boolean getDynamic() /*-{
		return this.dynamic;
	}-*/;
	
	public native final JsArray<JavaScriptObject> getFaces() /*-{
		return this.faces;
	}-*/;
	
	public native final JsArray<JsArray<Vector2>> getFaceUvs() /*-{
		return this.faceUvs;
	}-*/;
	
	public native final JsArray<JsArray<Vector2>> getFaceVertexUvs() /*-{
		return this.faceVertexUvs;
	}-*/;
	
	public native final boolean getHasTangents() /*-{
		return this.hasTangents;
	}-*/;
	
	public native final int getId() /*-{
		return this.id;
	}-*/;
	
	public native final JsArray<Material> getMaterials() /*-{
		return this.materials;
	}-*/;
	
	public native final JsArray<MorphColor> getMorphColors() /*-{
		return this.morphColors;
	}-*/;
	
	public native final JsArray<MorphTarget> getMorphTargets() /*-{
		return this.morphTargets;
	}-*/;
	
	public native final String getName() /*-{
		return this.name;
	}-*/;
	
	public native final JsArrayInteger getSkinIndices() /*-{
		return this.skinIndices;
	}-*/;
	
	public native final JsArrayNumber getSkinWeights() /*-{
		return this.skinWeights;
	}-*/;
	
	public native final JsArray<Vector3> getVertices() /*-{
		return this.vertices;
	}-*/;
	
	public native final void mergeVertices() /*-{
		this.mergeVertices();
	}-*/;
	
}
